package com.hoopchina.util.download;

public class DownloadTask {
	private String mUrl = "";
	private String mSavePath = "";
	private String mNameUrl = "";
	private Type mType = null;
	private boolean mIsFinished = false;
	private boolean mHasImg = false;

	public enum Type {
		XML_HOME_LIST, JSON_LOCAL_LIST, XML_HOME_DETAIL, IMG
	};

	public DownloadTask(String aUrl, String aSavePath) {
		this.mUrl = aUrl;
		this.mSavePath = aSavePath;
		this.mType = null;
	}

	public DownloadTask(String aUrl, String aSavePath, Type aType) {
		this.mUrl = aUrl;
		this.mSavePath = aSavePath;
		this.mType = aType;
	}

	/**
	 * 列表XML文件的文件名需要保存成去除后缀的原始链接，故多加一个参数aFileNameUrl用来转成UUID保存文件。
	 * 
	 * @param aNameUrl
	 * @param aUrl
	 * @param aSavePath
	 * @param aType
	 */
	public DownloadTask(String aNameUrl, String aUrl, String aSavePath,
			Type aType) {
		this.mNameUrl = aNameUrl;
		this.mUrl = aUrl;
		this.mSavePath = aSavePath;
		this.mType = aType;
	}

	public void setTargetUrl(String mUrl) {
		this.mUrl = mUrl;
	}

	public String getTargetUrl() {
		return mUrl;
	}

	public void setSavePath(String aSavePath) {
		this.mSavePath = aSavePath;
	}

	public String getSavePath() {
		return mSavePath;
	}

	public void setType(Type mType) {
		this.mType = mType;
	}

	public Type getType() {
		return mType;
	}

	public void setStatus(boolean aStatus) {
		this.mIsFinished = aStatus;
	}

	public boolean getStatus() {
		return mIsFinished;
	}

	public void setImgFlag(boolean flag) {
		mHasImg = flag;
	}

	public boolean hasImgFlag() {
		return mHasImg;
	}

	public void setNameUrl(String aUrl) {
		this.mNameUrl = aUrl;
	}

	public String getNameUrl() {
		return mNameUrl;
	}
}